package minefak3r;

/**
 *
 * @author Chriss
 */
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class ServerList {

    String path;
    Scanner reader;
    PrintStream ps;
    String list = "";
    String addresses[] = new String[100];
    
    public ServerList(String path) throws Exception {
        ps = new PrintStream(new FileOutputStream(path, true));
        reader = new Scanner(new FileInputStream(path));
        int counter = 0;
        while (reader.hasNextLine()) {
            String line = reader.nextLine();
            list += "[" + counter + "]" + line + " \n";
            addresses[counter] = line;
            counter++;
        }
    }

    public void addServer(String address) {
        ps.println(address);
    }

    public String getServer() {
        return list;
    }

    public String getServerAdress(int indexNumber) {
        return addresses[indexNumber];
    }
}
